<?php
class Control_DataAnalysis_activityEffect {

	function activityEffect() {
		$nowGame = 	$game 	= 	MooForm::request('game');
		$activityId 		= 	MooForm::request('activityId');
		$game = MooObj::get('Game')->transportGame($game);
		$nowChannel = $channel = MooObj::get('Game')->transportChannel($game, $channel);
		$action 		= 	MooForm::request('action');
		// 设置活动信息
		if($action == 0) {
			MooView::render('activityEffect');
		} else if($action == 1) {
			MooObj::get('Control_Data')->setPlatformData($game);
			$activityEffectConf = MooConfig::get('activityeffect.' . $game);
			$activitys = array();
			if($activityEffectConf) {
				foreach ($activityEffectConf as $key => $val) {
					$activity['id'] = $key;
					$activity['name'] = $val;
					$activitys[] = $activity;
				}
			}
			
			$fetch_activity = MooConfig::get('main.dataAnalysis.fetch_activity');
			$url = $fetch_activity . "?game=" . $game . "&activityid=" . $activityId;
			$data = MooUtil::curl_send($url);
			
			// $data = '[{"activityno":"1","puidcount":"3","goldconsume":"600"},{"activityno":"2","puidcount":"2","goldconsume":"500"}]';
			if($data) {
				$dataArr = MooJson::decode($data, true);
				MooView::set('dataArr', $dataArr);
			}
			
			MooView::set('activitys', $activitys);
			MooView::set('nowGame', $nowGame);
			MooView::set('nowActivityId', $activityId);
			
			MooView::set('viewData', $viewData);
			MooView::set('goldSource', $dataArr);
			MooView::render('activityEffect');
		} else {
			exit("error!");
		}
	}
}